<template>
  <div id="experience">
    <!-- 操作按钮 -->
    <!-- <freshCom @searchList="searchList"></freshCom> -->
    <el-table
      id="share-box"
      v-loading="loading"
      :data="tableData"
      max-height="490"
      style="width: 100%"
      ref="table"
    >
      <el-table-column type="index" width="50" label="序号">
        <template slot-scope="scope">
          {{ scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column
        prop="collegeTitle"
        label="学院名称"
        min-width="120"
      ></el-table-column>
      <el-table-column
        prop="updateTime"
        label="修改时间"
        min-width="120"
      ></el-table-column>
      <el-table-column
        prop="polyvStatuDesc"
        label="审核状态"
        min-width="120"
      ></el-table-column>
      <el-table-column prop="configured" label="状态" min-width="120">
        <template slot-scope="scope">
          {{ scope.row.configured ? '已配置' : '未配置' }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="120">
        <template slot-scope="scope">
          <el-button
            type="text"
            v-permission="'wh:trial:applet:setBtn'"
            @click="showDialog(scope.row)"
          >
            配置
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <dialogMaterialConfig
      v-if="dialogData.isShow"
      :dialog-data="dialogData"
      @refresh="refresh"
    ></dialogMaterialConfig>
  </div>
</template>

<script>
import { getCollegeMaterialsList } from '@/api/appletsManagement/experienceCourseMaterialConfig' // 接口
import dialogMaterialConfig from '@component/appletsManagement/experienceCourseMaterialConfig/dialogMaterialConfig' // 配置弹窗
export default {
  name: 'experience',
  msg: '体验课',
  components: {
    dialogMaterialConfig
  },
  data() {
    return {
      loading: false,
      tableData: [],
      dialogData: {
        isShow: false, // 默认隐藏
        params: null // 传递的参数
      }
    }
  },
  mounted() {
    this.searchList()
  },
  methods: {
    /* 获取列表 */
    searchList() {
      this.loading = true
      let obj = { type: 'TRIAL' }
      getCollegeMaterialsList(
        obj,
        (response) => {
          this.loading = false
          this.tableData = response
        },
        (response) => {
          this.loading = false
          this.$message({
            message: response.message,
            type: 'warning'
          })
        }
      )
    },
    showDialog(params) {
      this.dialogData.isShow = true
      this.dialogData.params = params
      this.dialogData.type = 'TRIAL'
    },
    /* 新增编辑后，刷新列表 */
    refresh() {
      this.searchList()
    }
  }
}
</script>

<style lang="less">
#experience {
}
</style>
